package org.bingo.controller;

import cn.dev33.satoken.exception.NotLoginException;
import org.bingo.misc.Result;
import org.bingo.misc.ResultState;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class SaTokenExceptionHandler {

    @ExceptionHandler(NotLoginException.class)
    @ResponseBody
    public Result noLoginException(NotLoginException e) {
        return Result.build(ResultState.NO_LOGIN, e.getMessage());
    }
}
